#ifndef SCRIPTH_H
#define SCRIPTH_H

class ScriptHeader{
public:
	typedef struct {
		unsigned short _version;
		int    _stackSize;
		int    _globalDataSize;
		int    _mainIndex; // -1 means not present
	} SH;

public:
    ScriptHeader() {
        memset(&_sh, 0, sizeof(_sh));
        _sh._mainIndex = -1;
    }

	void   dump();
	void   set(int stackSize, int globalDataSize, int mainIndex);
	void   setVersion(unsigned char min, unsigned char maj);
	unsigned char minor();
	unsigned char major();
	void   writeFile(FILE *fp);
	int    readFile(FILE *fp);

public:
	SH _sh;
	static char SCRIPTHEAD[4];
};


#endif
